package net.yb.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * 定义一个过滤器，实现Filter接口
 */
@WebFilter("/*")
public class MyFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("在调用目标资源之前，进行拦截处理。。。。。。。。。。");

        // 放行
        filterChain.doFilter(servletRequest, servletResponse);

        System.out.println("在调用目标资源之后，进行拦截处理。。。。。。。。。。");
    }
}
